Skip to content

xds: Implementation of Unified Matcher#12640

Merged
shivaspeaks merged 30 commits into
grpc:masterfrom
shivaspeaks:xds-unified-matcher-and-cel
Jul 1, 2026
Merged

xds: Implementation of Unified Matcher#12640
shivaspeaks merged 30 commits into
grpc:masterfrom
shivaspeaks:xds-unified-matcher-and-cel

Conversation

@shivaspeaks

@shivaspeaks shivaspeaks commented Feb 3, 2026

Copy link
Copy Markdown
Member

Implements gRFC A106: xDS Unified Matcher
grpc/proposal#520

@shivaspeaks shivaspeaks force-pushed the xds-unified-matcher-and-cel branch from 082243d to f472c63 Compare February 3, 2026 10:11
@shivaspeaks shivaspeaks marked this pull request as ready for review February 8, 2026 09:01

@l46kok l46kok left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about the drive-by -- I happened to notice this while putting together an unrelated PR in CEL-Java. I'll hold off on submitting it on our end.

Comment thread gradle/libs.versions.toml Outdated
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/CelCommon.java Outdated
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/CelMatcher.java Outdated
Comment thread gradle/libs.versions.toml Outdated
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/CelCommon.java Outdated
copybara-service Bot pushed a commit to cel-expr/cel-java that referenced this pull request Feb 18, 2026
copybara-service Bot pushed a commit to cel-expr/cel-java that referenced this pull request Feb 18, 2026
copybara-service Bot pushed a commit to cel-expr/cel-java that referenced this pull request Feb 18, 2026
copybara-service Bot pushed a commit to cel-expr/cel-java that referenced this pull request Feb 18, 2026
Also removes antlr dependency from `dev.cel:runtime` artifact

Fixes: #566
See also grpc/grpc-java#12640
PiperOrigin-RevId: 871541021
copybara-service Bot pushed a commit to cel-expr/cel-java that referenced this pull request Feb 18, 2026
Also removes antlr dependency from `dev.cel:runtime` artifact

Fixes: #566
See also grpc/grpc-java#12640
PiperOrigin-RevId: 871541021
copybara-service Bot pushed a commit to cel-expr/cel-java that referenced this pull request Feb 18, 2026
Also removes antlr dependency from `dev.cel:runtime` artifact

Fixes: #566
See also grpc/grpc-java#12640
PiperOrigin-RevId: 871541021
copybara-service Bot pushed a commit to cel-expr/cel-java that referenced this pull request Feb 18, 2026
Also removes antlr dependency from `dev.cel:runtime` artifact

Fixes: #566
See also grpc/grpc-java#12640
PiperOrigin-RevId: 871541021
copybara-service Bot pushed a commit to cel-expr/cel-java that referenced this pull request Feb 18, 2026
Also removes antlr dependency from `dev.cel:runtime` artifact

Fixes: #566
See also grpc/grpc-java#12640
PiperOrigin-RevId: 871541021
copybara-service Bot pushed a commit to cel-expr/cel-java that referenced this pull request Feb 18, 2026
Also removes antlr dependency from `dev.cel:runtime` artifact

Fixes: #566
See also grpc/grpc-java#12640
PiperOrigin-RevId: 871541021
copybara-service Bot pushed a commit to cel-expr/cel-java that referenced this pull request Feb 18, 2026
Also removes antlr dependency from `dev.cel:runtime` artifact

Fixes: #566
See also grpc/grpc-java#12640
PiperOrigin-RevId: 871541021
copybara-service Bot pushed a commit to cel-expr/cel-java that referenced this pull request Feb 18, 2026
Also removes antlr dependency from `dev.cel:runtime` artifact

Fixes: #566
See also grpc/grpc-java#12640
PiperOrigin-RevId: 871541021
copybara-service Bot pushed a commit to cel-expr/cel-java that referenced this pull request Feb 18, 2026
Also removes antlr dependency from `dev.cel:runtime` artifact

Fixes: #566
See also grpc/grpc-java#12640
PiperOrigin-RevId: 871541021
copybara-service Bot pushed a commit to cel-expr/cel-java that referenced this pull request Feb 18, 2026
Also removes antlr dependency from `dev.cel:runtime` artifact

Fixes: #566
See also grpc/grpc-java#12640
PiperOrigin-RevId: 872010923
@ejona86 ejona86 requested a review from sergiitk February 23, 2026 18:02
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/CelCommon.java Outdated
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/MatchInput.java
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/MatcherRunner.java Outdated
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/UnifiedMatcher.java Outdated
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/OnMatch.java
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/PredicateEvaluator.java Outdated
Comment thread xds/src/test/java/io/grpc/xds/internal/matcher/UnifiedMatcherTest.java Outdated
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/PredicateEvaluator.java Outdated
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/PredicateEvaluator.java Outdated
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/MatchInput.java Outdated
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/PredicateEvaluator.java Outdated
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/PredicateEvaluator.java Outdated
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/HeaderMatchInput.java Outdated

@asheshvidyut asheshvidyut left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewing for learning purposes.

Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/CelCommon.java Outdated
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/CelMatcher.java Outdated
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/CelCommon.java
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/CelCommon.java
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/CelStateMatcher.java Outdated
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/MatchInputRegistry.java Outdated
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/OnMatch.java Outdated
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/OnMatch.java
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/PredicateEvaluator.java Outdated
@shivaspeaks shivaspeaks force-pushed the xds-unified-matcher-and-cel branch from 8515729 to f312c9c Compare June 8, 2026 09:35
@shivaspeaks shivaspeaks changed the title xds: Implementation of Unified Matcher and CEL Integration xds: Implementation of Unified Matcher Jun 11, 2026
Comment thread xds/src/main/java/io/grpc/xds/internal/MatcherParser.java
Comment thread xds/src/main/java/io/grpc/xds/internal/MatcherParser.java
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/CelStateMatcher.java
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/HeaderMatchInput.java Outdated
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/HeaderMatchInput.java Outdated
Comment thread xds/src/test/java/io/grpc/xds/internal/matcher/CelStateMatcherTest.java Outdated

@kannanjgithub kannanjgithub left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed source code, yet to review tests.

Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/MatcherList.java
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/UnifiedMatcher.java Outdated
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/MatcherTree.java
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/MatcherTree.java Outdated
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/MatcherTree.java Outdated
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/MatchResult.java Outdated
Comment thread xds/src/main/java/io/grpc/xds/internal/MatcherParser.java Outdated
Comment thread xds/src/main/java/io/grpc/xds/internal/MatcherParser.java
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/PredicateEvaluator.java Outdated
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/MatchContext.java
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/MatchResult.java Outdated
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/MatcherTree.java Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements gRFC A106 “xDS Unified Matcher” in the io.grpc.xds.internal.matcher package, adding a proto-driven matcher runtime (list/tree forms), pluggable input/matcher registries, and CEL-based matching support, along with extensive validation and behavior tests.

Changes:

  • Added UnifiedMatcher runtime with MatcherList/MatcherTree execution, OnMatch handling, recursion-depth validation, and MatchResult aggregation semantics.
  • Introduced pluggable registries (MatchInputRegistry, MatcherRegistry) and concrete implementations for header inputs and CEL-state matching.
  • Added comprehensive unit tests covering validation, keep-matching semantics, matcher-tree behaviors, and CEL matching/extraction.

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
xds/src/test/java/io/grpc/xds/internal/matcher/UnifiedMatcherValidationTest.java New validation tests for unified matcher parsing and input/matcher constraints.
xds/src/test/java/io/grpc/xds/internal/matcher/UnifiedMatcherTest.java New behavioral tests for matcher list semantics, inputs, and runner behavior.
xds/src/test/java/io/grpc/xds/internal/matcher/MatcherTreeTest.java New behavioral tests for matcher tree exact/prefix matching and keep-matching behavior.
xds/src/test/java/io/grpc/xds/internal/matcher/CelStateMatcherTest.java New tests for CEL matcher integration, type mismatches, and safe failure modes.
xds/src/test/java/io/grpc/xds/internal/matcher/CelMatcherTestHelper.java Test helper updates to compile CEL matchers/extractors for test cases.
xds/src/main/java/io/grpc/xds/internal/Matchers.java Extended internal string matcher to support contains with ignoreCase.
xds/src/main/java/io/grpc/xds/internal/MatcherParser.java Added parsing for com.github.xds.type.matcher.v3.StringMatcher and ignoreCase contains.
xds/src/main/java/io/grpc/xds/internal/matcher/UnifiedMatcher.java New core unified matcher entry point and recursion-depth validation.
xds/src/main/java/io/grpc/xds/internal/matcher/PredicateEvaluator.java New predicate evaluation implementation for single/or/and/not matchers.
xds/src/main/java/io/grpc/xds/internal/matcher/OnMatch.java New “action vs nested matcher” handling and action type validation hook.
xds/src/main/java/io/grpc/xds/internal/matcher/MatchResult.java New immutable match result carrying actions and terminal-match state.
xds/src/main/java/io/grpc/xds/internal/matcher/MatchInputRegistry.java New registry for match input providers (header, CEL env).
xds/src/main/java/io/grpc/xds/internal/matcher/MatchInputProvider.java New provider interface for building MatchInput from typed configs.
xds/src/main/java/io/grpc/xds/internal/matcher/MatchInput.java New abstraction for extracting typed values from a MatchContext.
xds/src/main/java/io/grpc/xds/internal/matcher/MatcherTree.java New matcher-tree implementation with exact map and prefix trie matching.
xds/src/main/java/io/grpc/xds/internal/matcher/MatcherRunner.java New helper to run matchers and return terminal actions.
xds/src/main/java/io/grpc/xds/internal/matcher/MatcherRegistry.java New registry for custom matcher providers (e.g., CEL).
xds/src/main/java/io/grpc/xds/internal/matcher/MatcherProvider.java New provider interface for building Matcher implementations from typed configs.
xds/src/main/java/io/grpc/xds/internal/matcher/MatcherList.java New matcher-list implementation with keep-matching and on-no-match behavior.
xds/src/main/java/io/grpc/xds/internal/matcher/Matcher.java New matcher interface with optional declared input type.
xds/src/main/java/io/grpc/xds/internal/matcher/MatchContext.java Extended match context to include request id and builder support.
xds/src/main/java/io/grpc/xds/internal/matcher/HttpAttributesCelMatchInput.java New input that produces a CEL variable resolver from the match context.
xds/src/main/java/io/grpc/xds/internal/matcher/HeaderMatchInput.java New header input implementation with binary/ASCII handling and validation.
xds/src/main/java/io/grpc/xds/internal/matcher/CelStateMatcher.java New matcher provider for xDS CEL matcher extension with safe eval failure behavior.
xds/src/main/java/io/grpc/xds/internal/matcher/CelMatcher.java New CEL matcher runtime wrapper for boolean expressions.
Comments suppressed due to low confidence (1)

xds/src/test/java/io/grpc/xds/internal/matcher/CelMatcherTestHelper.java:67

  • CelMatcherTestHelper.compile() / compileStringExtractor() call production compile methods that declare throws CelEvaluationException, but these helper methods don't declare or handle that checked exception. This will fail compilation if CelEvaluationException is checked (as it is in this codebase).
  public static CelMatcher compile(String expression)
      throws dev.cel.common.CelException {
    CelAbstractSyntaxTree ast = COMPILER.compile(expression).getAst();
    return CelMatcher.compile(ast);
  }

  public static CelStringExtractor compileStringExtractor(String expression)
      throws dev.cel.common.CelException {
    CelAbstractSyntaxTree ast = COMPILER.compile(expression).getAst();
    return CelStringExtractor.compile(ast);
  }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/UnifiedMatcher.java Outdated
Comment thread xds/src/test/java/io/grpc/xds/internal/matcher/MatcherTreeTest.java Outdated
Comment thread xds/src/test/java/io/grpc/xds/internal/matcher/MatcherTreeTest.java
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/CelMatcher.java
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/MatchResult.java Outdated
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/MatcherList.java
@shivaspeaks shivaspeaks requested a review from kannanjgithub July 1, 2026 07:24
Comment thread xds/src/test/java/io/grpc/xds/internal/matcher/UnifiedMatcherValidationTest.java Outdated
Comment thread xds/src/test/java/io/grpc/xds/internal/matcher/UnifiedMatcherTest.java Outdated
@shivaspeaks shivaspeaks requested a review from kannanjgithub July 1, 2026 08:39
Comment thread xds/src/main/java/io/grpc/xds/internal/matcher/UnifiedMatcher.java
@shivaspeaks shivaspeaks dismissed sergiitk’s stale review July 1, 2026 15:38

Fine to merge with Kannan's review.

@shivaspeaks shivaspeaks merged commit 0cf5239 into grpc:master Jul 1, 2026
15 of 17 checks passed
@shivaspeaks shivaspeaks deleted the xds-unified-matcher-and-cel branch July 1, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants